<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.lmpop.trade.ti_shipping.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Hashtable ti_shipping = new Hashtable();
	//Ti_shipping ti_shipping = new Ti_shipping();
	String shipname = "";
	if(request.getParameter("shipname")!=null && !request.getParameter("shipname").equals("")){
		shipname = request.getParameter("shipname");
		ti_shipping.put("ship_name",shipname);
		//ti_shipping.setShip_name(shipname);
	}
	String ienable = "";
	if(request.getParameter("ienable")!=null && !request.getParameter("ienable").equals("")){
		ienable = request.getParameter("ienable");
		ti_shipping.put("is_enable",ienable);
		//ti_shipping.setIs_enable(ienable);
	}
	String ipay = "";
	if(request.getParameter("ipay")!=null && !request.getParameter("ipay").equals("")){
		ipay = request.getParameter("ipay");
		ti_shipping.put("is_pay",ipay);
		//ti_shipping.setIs_pay(ipay);
	}
	String start_date="";
	if(request.getParameter("start_date")!=null && !request.getParameter("start_date").equals("")){
		start_date = request.getParameter("start_date");
		ti_shipping.put("start_date",start_date);
	}
	String end_date = "";
	if(request.getParameter("end_date")!=null && !request.getParameter("end_date").equals("")){
		end_date = request.getParameter("end_date");
		ti_shipping.put("end_date",end_date);
	}		
	Ti_shippingInfo ti_shippingInfo = new Ti_shippingInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_shippingInfo.getListByPage(ti_shipping,Integer.parseInt(iStart),limit);
	int counter = ti_shippingInfo.getCountByObj(ti_shipping);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?shipname="+shipname+"&ienable="+ienable+"&ipay="+ipay+"&start_date="+start_date+"&end_date="+end_date+"&iStart=",Integer.parseInt(iStart),limit);
%>
<html>
  <head>
    
    <title>配送方式管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="shipping.js"></script> 
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>配送方式管理</h1>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left">
				配送方式名称:<input name="shipname" id="shipname" type="text" value=""/>
				是否货到付款:<select name="ipay" id="ipay">
								 <option value="">请选择</option>
								 <option value="0">是</option>
								 <option value="1">否</option>
							 </select>
				启用状态:<select name="ienable" id="ienable">
							 <option value="">请选择</option>
							 <option value="0">启用</option>
							 <option value="1">禁用</option>
						</select>
				<br>编辑时间:
										
											
				<input name="start_date" type="text" id="start_date" class="Wdate" value="" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'end_date\',{d:-1})}',readOnly:true})" size="15" />
					- 
				<input name="end_date" id="end_date" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'start_date\',{d:1})}',readOnly:true})" size="15"/>				 
				<input name="searchInfo" type="button" value="查询" onclick="return search();"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="8%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td width="8%">
				<input type="button" name="oper0" onclick="oper('0')" value="启用" class="buttab"/>
			</td>
			
			<td  width="72%">
				<input type="button" name="oper1" onclick="oper('1')" value="禁用" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>配送方式名称</th>
		  	
		  	<th>配送方式描述</th>
		  	
		  	<th>是否货到付款</th>
		  	
		  	<th>启用状态</th>
		  	
		  	<!--<th>到货区域</th>
		  	
		  	<th>货到付款支付费用</th>
		  	
		  	<th>免费额度</th>
		  	
		  	<th>续重费用</th>
		  	
		  	<th>首重费用</th>
		  	
		  	<th>单件商品费用</th>
		  	
		  	<th>费用计算方式</th>-->
		  	
		  	<th>编辑时间</th>
		  	
			<th width="10%">操作</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		for(int i=0;i<list.size();i++){
			Hashtable map = (Hashtable)list.get(i);
			String shipping_id="",cust_id="",ship_name="",ship_desc="",is_pay="",is_enable="",area_attr="",
			arrive_fare="",free_fare="",con_fare="",first_fare="",one_fare="",cal_type="",in_date="";
				if(map.get("shipping_id")!=null) shipping_id = map.get("shipping_id").toString();
				if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
				if(map.get("ship_name")!=null) ship_name = map.get("ship_name").toString();
				if(map.get("ship_desc")!=null) ship_desc = map.get("ship_desc").toString();
				if(map.get("is_pay")!=null) is_pay = map.get("is_pay").toString();
				if(map.get("is_enable")!=null) is_enable = map.get("is_enable").toString();
				if(map.get("area_attr")!=null) area_attr = map.get("area_attr").toString();
				if(map.get("arrive_fare")!=null) arrive_fare = map.get("arrive_fare").toString();
				if(map.get("free_fare")!=null) free_fare = map.get("free_fare").toString();
				if(map.get("con_fare")!=null) con_fare = map.get("con_fare").toString();
				if(map.get("first_fare")!=null) first_fare = map.get("first_fare").toString();
				if(map.get("one_fare")!=null) one_fare = map.get("one_fare").toString();
				if(map.get("cal_type")!=null) cal_type = map.get("cal_type").toString();
				if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
				String ispay="",isenable="";
				if(is_pay.equals("0")){ispay="是";}
				if(is_pay.equals("1")){ispay="否";}
				if(is_enable.equals("0")){isenable="启用";}
				if(is_enable.equals("1")){isenable="禁用";}
				if(in_date.length()>19)in_date=in_date.substring(0,19);

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=shipping_id %>" /></td>
			
		  	<td><a href="updateInfo.jsp?shipping_id=<%=shipping_id%>&shipname=<%=java.net.URLEncoder.encode(shipname)%>&ienable=<%=ienable%>&ipay=<%=ipay%>&start_date=<%=start_date%>&end_date=<%=end_date%>&iStart=<%=iStart%>"><%=ship_name%></a></td>
		  	
		  	<%
		  	if(ship_desc.length()>30){
		  		if(ship_desc.length()>30){
		  		ship_desc=ship_desc.substring(0,30);
		  		}
		  	%>
		  	<td><%=ship_desc%>...</td>
		  	<%
		  	} 
		  	else if(ship_desc.length()<=30){
		  	%>
		  	<td><%=ship_desc%></td>
		  	<% 
		  	}; 
		  	%>		  	
		  	
		  	<td><a href="index.jsp?ipay=<%=is_pay %>"><%=ispay%></a></td>
		  	
		  	<td><a href="index.jsp?ienable=<%=is_enable %>"><%=isenable%></a></td>
		  	
		  	<!--<td><%=area_attr%></td>
		  	
		  	<td><%=arrive_fare%></td>
		  	
		  	<td><%=free_fare%></td>
		  	
		  	<td><%=con_fare%></td>
		  	
		  	<td><%=first_fare%></td>
		  	
		  	<td><%=one_fare%></td>
		  	
		  	<td><%=cal_type%></td>-->
		  	
		  	<td><%=in_date%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?shipping_id=<%=shipping_id%>&shipname=<%=java.net.URLEncoder.encode(shipname)%>&ienable=<%=ienable%>&ipay=<%=ipay%>&start_date=<%=start_date%>&end_date=<%=end_date%>&iStart=<%=iStart%>"><img border="0" src="/program/admin/images/edit.gif" title="修改" /></a>|
			<a href="shipping_areaindex.jsp?shipping_id=<%=shipping_id %>"><img border="0" src="/program/admin/images/details.gif" title="配送方式区域设置" /></a></td>
	  		<td width="10%"><a href="javascript:delOneNews('<%=shipping_id%>');"><img border="0" src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="8%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td width="8%">
				<input type="button" name="oper0" onclick="oper('0')" value="启用" class="buttab"/>
			</td>
			
			<td  width="72%">
				<input type="button" name="oper1" onclick="oper('1')" value="禁用" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td align="center"><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input name="shipping_id" id="shipping_id" type="hidden" value=""/>
	  <input type="hidden" name="is_enable" id="is_enable" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="3076" />
	  </form>
</body>

</html>
